<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$Think.config.site.title} - 上传充电宝信息</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.css?v=4.1.0" rel="stylesheet">
</head>
<style type="text/css">
    .text-center{ border:3px dashed #e6e6e6; padding: 5%; }
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-sm-12">
                <form action=""  enctype="multipart/form-data" method="post" id="uploadForm">
                <div class="ibox float-e-margins">
                    <div class="text-center">
                        <a href="javascript:void(0)" style="color: #666666; font-size: 18px;" id="cliked">
                            <span class="corner"></span>

                            <div class="icon">
                                <i class="fa fa-file" style="font-size: 60px; color: #ccc"></i><br/><br/>
                                <span>{:lang('点击上传Excel文件')}</span>
                            </div>
                            
                        </a>
                        
                    </div>
                    <input type="hidden" name="oid" value="{$oid}" >
                    <input type="file" name="excel" id="excel" style="display: none;" ccept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" onchange="select_file_excel()" >
                </div>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="text-center" style="border:none;">
                    <a href="/uploads/Charging treasure import template.xls" style="color:#666;"><i class="fa fa-cloud-download" style="font-size: 55px; "></i><h3 style="font-weight: 100; font-size: 16px; padding-top: 15px;">{:lang('点击下载Excel模版文档')}</h3></a>
                    
                </div>
            </div>
        </div>
    </div>
    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.6"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/content.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/laydate/laydate.js"></script>
    <script type="text/javascript">
        $(function(){
            $('#cliked').click(function(){
                $("#excel").click();
            });  
            $('#excel').change(function(){

                //alert(123456);
                $.ajax({

                    url: '<?php echo \think\Request::instance()->root(); ?>/ausadmin/Operator/battery',
                    type: 'POST',
                    cache: false,
                    data: new FormData($('#uploadForm')[0]),
                    dataType:'json',
                    processData: false,
                    contentType: false,
                    success:function(result){
                        if(0 == result.code){
                            layer.msg(result.msg, {icon: 1, time:10000});
                            //parent.location.reload();
                        }else{
                            layer.msg(result.msg, {icon: 5});
                        }
                    },
                    error : function(result){
                        layer.msg('服务器错误！请稍后重试', {icon: 2});
                    }

                })
            });
        });
        
    </script>
</body>
</html>